<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="app">
  <button @click="destroyVM">destroy vm</button>
  <p v-show="isShow">mask</p>
</div>

<script type="text/javascript" src="../../js/vue.js"></script>
<script type="text/javascript">
  const vm = new Vue({
    el: '#app',
    data: {
      isShow: true
    },
    mounted () { //初始化显示后立即调用
      this.intervalId = setInterval(() => {
        console.log("---")
        this.isShow !=this.isShow;
      },1000)
    },
    beforeDestroy () {
      clearInterval(this.intervalId);
    },

    methods: {
      destroyVM () {
        this.$destroy();
      }
    }

  })


</script>
</body>
</html>